import { createRouter, createWebHistory } from "vue-router";
import home from "@/views/home/index.vue";
import search from "@/views/search/index.vue";

import index from "@/views/home/children/index.vue";
import list from "@/views/home/children/list.vue";
import car from "@/views/home/children/car.vue";
import my from "@/views/home/children/my.vue";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "home",
    },
    {
      path: "/home",
      name: "home",
      component: home,
      children: [
        {
          path: "index",
          name: "index",
          component: index,
        },
        {
          path: "list",
          name: "list",
          component: list,
        },
        {
          path: "car",
          name: "car",
          component: car,
        },
        {
          path: "my",
          name: "my",
          component: my,
        },
      ],
    },
    {
      path: "/search",
      name: "search",
      component: search,
    },
  ],
});

export default router;
